#!/usr/bin/env python
import math
from scipy.integrate import quad
import numpy
from matplotlib.pyplot import *
from unit import cm_to_freq
from constant import *
from spectral_density import *
from bath import * 


def plot_correlation(T, Spectral_Density, step, x_range, parameters, filename = None):
	# plot correlation is used to plot bath correlation function 
	start = x_range[0] / step
	end = x_range[1] / step
	t_range = [step * i for i in range(int(start) - 1, int(end) + 1)]
	reresults = []
	imresults = []
	for t in t_range:
		ret = bath_response_function(T, t, Spectral_Density, parameters)
		reresults.append(ret[0])
		imresults.append(ret[1])
	plot(t_range, reresults)
	plot(t_range, imresults)
	show()
	if filename is not None:
		savefig(filename)

